chi_squared_distribution Derived Type

type, public, extends(distribution) :: chi_squared_distribution

Defines a Chi-squared distribution.


Components

Type Visibility Attributes Name Initial
integer(kind=int32), public :: dof

The number of degrees of freedom.


Type-Bound Procedures

procedure, public :: cdf => cs_cdf

  • private pure elemental function cs_cdf(this, x) result(rst)

    Computes the cumulative distribution function.

    The CDF for a Chi-squared distribution is given as .

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    The chi_squared_distribution object.

    real(kind=real64), intent(in) :: x

    The value at which to evaluate the function.

    Return Value real(kind=real64)

    The value of the function.

procedure, public :: defined_range => cs_range

  • private pure function cs_range(this) result(rst)

    Gets the defined range for the distribution.

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    The chi_squared_distribution object.

    Return Value real(kind=real64), dimension(2)

    The defined range of the probability distributions [0, infinity). As using a value of infinity may cause issue, this routine returns huge(0.0d0) instead.

procedure, public :: log_cdf => cs_log_cdf

  • private pure elemental function cs_log_cdf(this, x) result(rst)

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    Distribution with valid parameters.

    real(kind=real64), intent(in) :: x

    Evaluation point.

    Return Value real(kind=real64)

    Log probability; zero probability gives -infinity, invalid inputs NaN.

procedure, public :: log_pdf => cs_log_pdf

  • private pure elemental function cs_log_pdf(this, x) result(rst)

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    Distribution with valid parameters.

    real(kind=real64), intent(in) :: x

    Evaluation point; discrete masses require integer-valued x.

    Return Value real(kind=real64)

    Log density; outside support gives -infinity, invalid inputs give NaN. An integrable density singularity at a support endpoint gives +infinity.

procedure, public :: log_survival => cs_log_survival

  • private pure elemental function cs_log_survival(this, x) result(rst)

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    Distribution with valid parameters.

    real(kind=real64), intent(in) :: x

    Evaluation point.

    Return Value real(kind=real64)

    Log probability; zero probability gives -infinity, invalid inputs NaN.

procedure, public :: mean => cs_mean

  • private pure function cs_mean(this) result(rst)

    Computes the mean of the distribution.

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    The chi_squared_distribution object.

    Return Value real(kind=real64)

    The mean.

procedure, public :: median => cs_median

  • private pure function cs_median(this) result(rst)

    Computes the median of the distribution.

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    The chi_squared_distribution object.

    Return Value real(kind=real64)

    The median.

procedure, public :: mode => cs_mode

  • private pure function cs_mode(this) result(rst)

    Computes the mode of the distribution.

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    The chi_squared_distribution object.

    Return Value real(kind=real64)

    The mode.

procedure, public :: pdf => cs_pdf

  • private pure elemental function cs_pdf(this, x) result(rst)

    Computes the probability density function.

    The PDF for a Chi-squared distribution is given as .

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    The chi_squared_distribution object.

    real(kind=real64), intent(in) :: x

    The value at which to evaluate the function.

    Return Value real(kind=real64)

    The value of the function.

procedure, public :: recenter => cs_recenter

  • private subroutine cs_recenter(this, x)

    Recenters the distribution about the supplied value.

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(inout) :: this

    The chi_squared_distribution object.

    real(kind=real64), intent(in) :: x

    The value about which to recenter.

procedure, public :: standardized_variable => dist_std_var

  • private pure elemental function dist_std_var(this, x) result(rst)

    Computes the standardized variable for the distribution.

    Arguments

    Type IntentOptional Attributes Name
    class(distribution), intent(in) :: this

    The distribution object.

    real(kind=real64), intent(in) :: x

    The value of interest.

    Return Value real(kind=real64)

    The result.

procedure, public :: survival => cs_survival

  • private pure elemental function cs_survival(this, x) result(rst)

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    Distribution with valid parameters.

    real(kind=real64), intent(in) :: x

    Evaluation point; discrete tails include masses strictly above x.

    Return Value real(kind=real64)

    Probability on [0, 1]; invalid parameters or NaN x give NaN.

procedure, public :: variance => cs_variance

  • private pure function cs_variance(this) result(rst)

    Computes the variance of the distribution.

    Arguments

    Type IntentOptional Attributes Name
    class(chi_squared_distribution), intent(in) :: this

    The chi_squared_distribution object.

    Return Value real(kind=real64)

    The variance.